<?php

declare(strict_types=1);

namespace App\CustHub\Model;

use Mine\MineModel;

/**
 * @property int $id 
 * @property int $uid 
 * @property int $main_uid 
 * @property string $name 方案名称
 * @property int $wechat_type 微号类型：0=个微 1=企微
 * @property array $time_frame 转发时间段
 * @property array $relay_types 转发内容类型
 * @property array $filter_content 过滤内容
 * @property array $replace_list 替换内容
 * @property int $is_auto_sticker_fallback 图片超频时自动转表情包：0=否 1=是
 * @property int $is_image_to_sticker 图片默认转为表情包发送：0=否 1=是
 * @property int $is_auto_chain_transfer 是否自动转链：0=否 1=是
 * @property array $chain_transfer_config 转链配置
 * @property array $chain_whitelist 链接白名单（原文如包含链接，且链接不在白名单中，则链接将被替换为空，继续发送原文）
 * @property int $chain_transfer_fail_skip 转链失败是否跳过：0=否 1=是
 * @property int $chain_transfer_tpl_switch 自定义模板开关：0=关 1=开
 * @property string $chain_transfer_tpl 发单模板
 * @property string $chain_transfer_tips 发单小尾巴说明
 * @property array $chain_filter_keyword 发单过滤，遇到当前配置的关键词不转发
 * @property int $limit_switch 限频开关：0=关 1=开
 * @property int $text_sleep_time 文本内容发送频率，单位毫秒
 * @property int $non_text_sleep_time 其他内容发送频率，单位毫秒
 * @property int $broadcast_type 转播类型：0=客户群 1=角色方案
 * @property array $target_room_ids 转播群
 * @property array $broadcast_ids 转播人
 * @property int $role_id 角色ID
 * @property int $role_plan_id 角色方案ID
 * @property int $status 状态：0=禁用 1=启用
 * @property \Carbon\Carbon $created_at 
 * @property \Carbon\Carbon $updated_at 
 * @property-read null|\Hyperf\Database\Model\Collection|ChRoomBroadcastConfig[] $sources 
 */
class ChRoomBroadcast extends MineModel
{

    public const ENABLE = 1;
    public const DISABLE = 0;

    /**
     * The table associated with the model.
     */
    protected ?string $table = 'ch_room_broadcast';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['id', 'uid', 'main_uid', 'name', 'wechat_type', 'time_frame', 'relay_types', 'filter_content', 'replace_list', 'is_auto_sticker_fallback', 'is_image_to_sticker', 'is_auto_chain_transfer', 'chain_transfer_config', 'chain_whitelist', 'chain_transfer_fail_skip', 'chain_transfer_tpl_switch', 'chain_transfer_tpl', 'chain_transfer_tips', 'chain_filter_keyword', 'limit_switch', 'text_sleep_time', 'non_text_sleep_time', 'broadcast_type', 'target_room_ids', 'broadcast_ids', 'role_id', 'role_plan_id', 'status', 'created_at', 'updated_at'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'uid' => 'integer', 'main_uid' => 'integer', 'wechat_type' => 'integer', 'time_frame' => 'array', 'relay_types' => 'array', 'filter_content' => 'array', 'replace_list' => 'array', 'is_auto_sticker_fallback' => 'integer', 'is_image_to_sticker' => 'integer', 'is_auto_chain_transfer' => 'integer', 'chain_transfer_config' => 'array', 'chain_whitelist' => 'array', 'chain_transfer_fail_skip' => 'integer', 'chain_transfer_tpl_switch' => 'integer', 'chain_filter_keyword' => 'array', 'limit_switch' => 'integer', 'text_sleep_time' => 'integer', 'non_text_sleep_time' => 'integer', 'broadcast_type' => 'integer', 'target_room_ids' => 'array', 'broadcast_ids' => 'array', 'role_id' => 'integer', 'role_plan_id' => 'integer', 'status' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];

    public function sources(): \Hyperf\Database\Model\Relations\HasMany
    {
        return $this->hasMany(ChRoomBroadcastConfig::class,'room_broadcast_id','id');
    }
}
